<?php
/**
 * Created by PhpStorm.
 * User: jimmyhsu
 * Date: 2016/10/16
 * Time: 下午1:16
 */
include "conn.php";
$name = $_POST["myname"];
$deviceId = $_POST["deviceid"];
$otherName = $_POST["othername"];
$itemId = $_POST['id'];
$checkSql = "select * from userinfo where name='$name' and deviceid='$deviceId'";
$checkRs = mysql_query($checkSql);
if (mysql_num_rows($checkRs) <= 0) {
    die("invalid request");
}
$sql = "select * from userinfo where name='$otherName'";
$rs = mysql_query($sql);
$arr = mysql_fetch_array($rs);
$regdate = $arr['regdate'];
$sign = $arr['signature'];
$headUrl = $arr['image'];
$sql = "select * from secondhandtb where id=$itemId";
$rs = mysql_query($sql);
$arr2 = mysql_fetch_array($rs);
$contact = $arr2['contact'];
$rsArr = array("regdate"=>$regdate, "sex"=>$arr['sex'], "sign"=>urlencode($sign), "contact"=>urldecode($contact), "url"=>urlencode($headUrl));
echo urldecode(json_encode($rsArr));